<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div
      class="content-parent border-hover-style"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style15/Auxiliaryoutlinestyle2Bg.webp'})`,
      }"
    >
      <div class="audio-parent">
        <audioCom :info="props.info" ref="audioParent" />
      </div>

      <div class="content">
        <div class="title-box">{{ props.info.text }}</div>
        <div
          class="solid"
          :style="{
            backgroundImage: `url(${
              publicUrls + 'free/style15/Auxiliaryoutlinestyle2BgTitle.webp'
            })`,
          }"
        ></div>
        <p class="subtitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
        <p
          class="subtitle-2"
          v-else-if="((props.info.video && props.info.video.url) || props.info.value) && props.info.remarks"
        ></p>
        <div
          class="content-bottom-1"
          v-if="((props.info.video && props.info.video.url) || props.info.value) && props.info.remarks"
        >
          <div class="bottom-1-left">
            <div
              class="img-parent"
              :style="{
                backgroundImage: `url(${
                  publicUrls + 'free/style15/Auxiliaryoutlinestyle2cover.webp'
                })`,
              }"
            >
              <div v-if="(props.info.video && props.info.video.url) || props.info.value" class="img-box">
                <videoview
                  @click="audioplay(false)"
                  :info="props.info"
                  v-if="props.info.video && props.info.video.url"
                ></videoview>
                <div v-else class="outline-cover">
                  <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
                </div>
              </div>
            </div>
          </div>
          <div class="bottom-1-right">
            <div class="remarks1" v-if="(props.info.video && props.info.video.url) || props.info.value">
              <TextMax
                :types="2"
                :color2="false"
                :infoData="props.info"
                v-if="props.domShow"
                :data="props.info.remarks"
                :title="props.info.text"
                :row="4"
              ></TextMax>
            </div>
          </div>
        </div>
        <div class="content-bottom-2" v-else :class="{ 'content-bottom-3': !props.info.remarks }">
          <div class="remarks2" v-if="props.info.subTitle && props.info.remarks">
            <TextMax
              :types="2"
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="4"
            ></TextMax>
          </div>
          <div class="remarks3" v-else-if="props.info.remarks">
            <TextMax
              :types="2"
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="6"
            ></TextMax>
          </div>
          <div
            class="img-parent"
            :style="{
              backgroundImage: `url(${
                publicUrls + 'free/style15/Auxiliaryoutlinestyle2cover2.webp'
              })`,
            }"
            v-if="((props.info.video && props.info.video.url) || props.info.value) && !props.info.subTitle"
          >
            <div class="img-box">
              <videoview
                @click="audioplay(false)"
                :info="props.info"
                v-if="props.info.video && props.info.video.url"
              ></videoview>
              <div v-else class="outline-cover">
                <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
              </div>
            </div>
          </div>
          <div
            class="img-parent img-parent-2"
            :style="{
              backgroundImage: `url(${
                publicUrls + 'free/style15/Auxiliaryoutlinestyle2cover.webp'
              })`,
            }"
            v-else-if="(props.info.video && props.info.video.url) || props.info.value"
          >
            <div class="img-box">
              <videoview
                @click="audioplay(false)"
                :info="props.info"
                v-if="props.info.video && props.info.video.url"
              ></videoview>
              <div v-else class="outline-cover">
                <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

 
 
<script setup lang="ts">
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/textMax15.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  margin-top: 0;
  height: 100%;
  margin-right: 140px;
}
.content-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 100px;
  width: 586px;
  height: 420px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.audio-parent {
  position: absolute;
  top: 20px;
  right: 10px;
  width: 50px;
  height: 50px;
}
.content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 586px;
  height: 420px;
  padding: 76px 65px 0px 65px;
}

.title-box {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 330px;
  height: 30px;
  color: rgba(255, 255, 255, 1);
  text-align: center;
  /* 三级标题 */
  font-family: SourceHanSerifCN-Bold;
  font-size: 20px;
  line-height: 30px; /* 150% */
}
.solid {
  width: 360px;
  height: 12px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-top: 4px;
}
.img-box {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;

  :deep(video) {
    background: rgba(57, 56, 54, 0.1);
  }
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }
}
.subtitle {
  display: flex;
  align-items: center;
  width: 100%;
  height: 56px;
    font-family: SourceHanSerifCN;
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
  color: #fff;
  text-align: center;
  margin-top: 8px;
}
.subtitle-2 {
  height: 28px;
}
.img-box:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}

.remarks1 {
  width: 100%;
}
.content-bottom-1 {
  display: flex;
  width: 100%;
  margin-top: 12px;
}
.bottom-1-left {
  width: 220px;
  height: 128px;
  .img-parent {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 220px;
    height: 128px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    .img-box {
      width: 194px;
      height: 106px;
    }
  }
}
.bottom-1-right {
  display: flex;
  width: 210px;
  margin-left: 20px;
  .remarks1 {
    width: 100%;
    margin-top: 0px;
  }
}
.content-bottom-2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 450px;
  margin-top: 12px;

  .remarks2 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 128px;
    margin-top: 0px;
  }
  .remarks3 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 192px;
    margin-top: 0px;
  }

  .img-parent {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 450px;
    height: 192px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin-top: 0px;
    .img-box {
      width: 424px;
      height: 170px;
    }
  }
  .img-parent-2 {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 220px;
    height: 128px;
    margin: 0 auto;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    .img-box {
      width: 194px;
      height: 106px;
    }
  }
}
.content-bottom-3 {
  margin-top: 8px;
}
</style>
